package com.pig.graduate.controller.pigFarm;


import com.pig.graduate.domain.material.MaterialInventory;
import com.pig.graduate.domain.pigFarm.BuildsFarm;
import com.pig.graduate.domain.pigFarm.EventExitFarm;
import com.pig.graduate.domain.pigFarm.SowFarm;
import com.pig.graduate.domain.pigFarm.dto.BoarStateDTO;
import com.pig.graduate.result.MyResult;
import com.pig.graduate.service.event.EventExitService;
import com.pig.graduate.service.produce.ProduceBoarService;
import com.pig.graduate.service.sys.SysBuildingsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = {"猪场报表"}, description = "猪场报表")
@RestController
@RequestMapping("/pig/farm")
public class PigFarmController {

    @Autowired
    private SysBuildingsService sysBuildingsService;

    @Autowired
    private EventExitService eventExitService;

    @Autowired
    private ProduceBoarService produceBoarService;


    @ApiOperation(value = "猪舍存栏",notes = "猪舍存栏")
    @GetMapping("/buildsFarm")
    public MyResult buildsFarm(@RequestParam("pageNum") Integer pageNum,
                               @RequestParam("pageSize") Integer pageSize){

        return sysBuildingsService.getBuildsFarm(pageNum,pageSize);
    }

    @ApiOperation(value = "死淘分析",notes = "死淘分析")
    @PostMapping("/deadAnalyse")
    public MyResult deadAnalyse(){
        List<EventExitFarm> list = eventExitService.getExitFarm();
        return MyResult.success(list);
    }

    @ApiOperation(value = "胎龄比率",notes = "胎龄比率")
    @PostMapping("/birthsRatio")
    public MyResult birthsRatio(){
        List<SowFarm> sowFarm = produceBoarService.getSowFarm();
        return MyResult.success(sowFarm);
    }

    @ApiOperation(value = "种猪状态统计",notes = "种猪状态统计")
    @GetMapping("/boatState")
    public MyResult boatState(){
        List<BoarStateDTO> list = produceBoarService.getBoarForState();
        return MyResult.success(list);
    }

    @ApiOperation(value = "存储情况统计",notes = "存储情况统计")
    @GetMapping("/indexStock")
    public MyResult indexStock(){
        return sysBuildingsService.getIndexStock();
    }

}
